<?php $this->load->module('index/index/head');?>
<?php $this->load->module('member/index/center_head');?>

<div class="container">
    <div class="row">
        <div class="col-md-12">
            <div class="breadcrumb-box">
                <span class="breadcrumb-new-style">您所在的位置：</span>
                <ol class="breadcrumb ol-bgc">
                    <li><a href="<?php echo site_url('member/index/center')?>">会员中心</a></li>
                    <li class="active">修改密码</li>
                </ol>
            </div>
        </div>
        <?php $this->load->module('member/index/center_left',$extra);?>

        <div class="col-md-9 member-center-box-margin">
            <div class="col-md-12 member-center-title-left-border bg-warning">
                <h4><strong>修改密码</strong></h4>
            </div>
            <div class="changepassword">
                <form method="post" class="formvalidate form-horizontal" action="<?php echo $form_url;?>">
                    <div class="persona-info-container">
                        <div class="form-group" id="mobile">
                            <label class="col-md-2 control-label">原密码</label>
                            <div class="col-md-4">
                                <input name="Form[old]" autocomplete="off" type="password" class="input rounded  form-control" validate="{required:true,rangelength:[4,40]}" />
                            </div>
                            <div class="col-md-6 safety-text">
                                <label>请输入原密码</label>
                            </div>
                        </div>


                        <div class="form-group">
                            <label class="col-md-2 control-label">新密码</label>
                            <div class="col-md-4">
                                <input name="Form[password]" autocomplete="off" type="password"  onKeyUp="pwStrength(this.value)" onBlur="pwStrength(this.value)" class="input rounded form-control" id="password" validate="{required:true,rangelength:[4,40]}" />
                            </div>
                            <div class="col-md-6 safety-text">
                                <label>6-18位，区分大小写，请使用字母﹑数字﹑特殊符号中的两种或两种以上</label>
                            </div>
                            <div class="form-group">
                                <div class="col-md-4 col-md-offset-3 safety-form-group" >
                                    <span class="col-md-3" id="strength_L">弱</span>
                                    <span class="col-md-3" id="strength_M">中</span>
                                    <span class="col-md-3" id="strength_H">强</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label">确认密码</label>
                            <div class="col-md-4">
                                <input type="password" autocomplete="off" class="input rounded form-control " validate="{required:true,rangelength:[4,40],equalTo:'#password'}" />
                            </div>
                            <div class="col-md-6 safety-text">
                                <label>再次确认您的新密码</label>
                            </div>
                        </div>


                        <button class="col-md-2 col-md-offset-2 btn btn-primary changepassword-xz" type="submit">下一步</button>
                    </div>
                </form>
            </div>
        </div>

    </div>
</div>

<script language=javascript>
    //判断输入密码的类型
    function CharMode(iN){
        if (iN>=48 && iN <=57) //数字
            return 1;
        if (iN>=65 && iN <=90) //大写
            return 2;
        if (iN>=97 && iN <=122) //小写
            return 4;
        else
            return 8;
    }
    //bitTotal函数
    //计算密码模式
    function bitTotal(num){
        modes=0;
        for (i=0;i<4;i++){
            if (num & 1) modes++;
            num>>>=1;
        }
        return modes;
    }
    //返回强度级别
    function checkStrong(sPW){
        if (sPW.length<=4)
            return 0; //密码太短
        Modes=0;
        for (i=0;i<sPW.length;i++){
//密码模式
            Modes|=CharMode(sPW.charCodeAt(i));
        }
        return bitTotal(Modes);
    }

    //显示颜色
    function pwStrength(pwd){
        O_color="#cccccc";
        L_color="#f15a24";
        M_color="#fbb13a";
        H_color="#38b54a";
        if (pwd==null||pwd==''){
            Lcolor=Mcolor=Hcolor=O_color;
        }
        else{
            S_level=checkStrong(pwd);
            switch(S_level) {
                case 0:
                    Lcolor=Mcolor=Hcolor=O_color;
                case 1:
                    Lcolor=L_color;
                    Mcolor=Hcolor=O_color;
                    break;
                case 2:
                    Lcolor=L_color;
                    Mcolor=M_color;
                    Hcolor=O_color;
                    break;
                default:
                    Lcolor=L_color;
                    Mcolor=M_color;
                    Hcolor=H_color;

            }
        }
        document.getElementById("strength_L").style.background=Lcolor;
        document.getElementById("strength_M").style.background=Mcolor;
        document.getElementById("strength_H").style.background=Hcolor;
        return;
    }
    pwStrength('');
</script>
<?php $this->load->module('index/index/foot');?>
